package ticketsell.csv;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

import ticketsell.model.DatosCompra;
import ticketsell.model.asistentes.AsistenteImpresionSala;

public class PrintEventAssistant implements AsistenteImpresionSala{

	@Override
	public void imprimirSala(List<DatosCompra> datos, File Destino) {
		
		try {
			BufferedWriter bw = new BufferedWriter(new FileWriter(Destino.getAbsolutePath()));		
		
			for (int i=0; i<datos.size(); i++){
				String linea = datos.get(i).getNombre() + "," + datos.get(i).getNumAsiento() + ","  + datos.get(i).getPrecio()+"\n";
				bw.write(linea);
			}
			
			bw.close();
			
		} catch (IOException e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
		
	}

}
